import { ui } from "../../ui/layaMaxUI";
import Game from "../../core_wq/game/Game";
import GameEvent from "../../core_wq/game/GameEvent";
import MonsterData from "../../core_wq/game/data/MonsterData";
import EffectUtil from "../../core_wq/utils/EffectUtil";



export default class TopGoldView extends ui.moduleView.main.TopGoldViewUI {


    constructor() {
        super();
        
        Laya.stage.on(GameEvent.REFRESH_GOLD, this, this.onRefreshGold);
        Laya.stage.on(GameEvent.REFRESH_DIAMOND, this, this.onRefreshDiamond);
    }

    onEnable() {
        if (this.diamond) {
            this.diamond.value = String(Game.hero.playerData.diamond);
            this.gold.value = String(Game.hero.playerData.gold);
        }
    }
 


    onRefreshGold(){
        EffectUtil.refreshNumEffect(Number(this.gold.value),Game.hero.playerData.gold,this.gold,600);
    }
    onRefreshDiamond(){
        console.log("onRefreshDiamond",Game.hero.playerData.diamond)
        EffectUtil.refreshNumEffect(Number(this.diamond.value),Game.hero.playerData.diamond,this.diamond,600);
    }




}